// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import VueRouter from 'vue-router'
import Store from './store/index'
//注入路由功能
Vue.use(VueRouter)

require("!style-loader!css-loader!less-loader!./assets/css/main.less");
require("!style-loader!css-loader!less-loader!./assets/css/animate.min.css");
import Creat from './page/creat.vue'
import CreatSelect from './page/CreatSelect.vue'
import CreatFinsh from './page/creatFinsh.vue'
import CreatSuccess from './page/creatSuccess.vue'
import Index from './page/index.vue'
import Plan from './page/plan.vue'
import PlanShow from './page/planShow.vue'
import ReviseBegin from './page/reviseBegin.vue'
import Revise from './page/revise.vue'
import ReviseError from './page/reviseError.vue'
import ErrorPage from './page/ErrorPage.vue'

const router = new VueRouter({
  // mode:'history',
  base:__dirname,
  routes:[
    {path:'/',component:Index},
    {path:'/ErrorPage',component:ErrorPage},
    {path:'/index',component:Index},
    {path:'/plan',component:Plan},
    {path:'/planShow',component:PlanShow},
    {path:'/reviseBegin',component:ReviseBegin},
    {path:'/revise',component:Revise},
    {path:'/reviseError',component:ReviseError},
    // {path:'/reviseError/:number',component:ReviseError},
    {path:'/creat',component:Creat},
    {path:'/CreatSelect',component:CreatSelect},
    {path:'/creatFinsh',component:CreatFinsh},
    {path:'/creatSuccess',component:CreatSuccess},
    // {path:'*',component:Index}
  ]
})

// Vue.config.productionTip = false

/* eslint-disable no-new */
var vm = new Vue({
  // el: '#app',
  router, //注入路由 让整个应用都有路由功能
  store:Store,
  data:{
    examTime:'2017-06-17',
    preExamDay:90,
    updateTimes:1
  },
  template:`
    <div>
        <transition name="fade" mode="out-in">
            <router-view></router-view>
        </transition>  
    </div>
  `,
  beforeCreate:function(){
    console.log(this.$store.state.newbi)
    if(this.$store.state.newbi == 1){
      router.push({path:'/plan'})
    }else{
      router.push({path:'/creat'})
    }
  }
}).$mount('#app');
